﻿using System;
using System.Collections;
using System.Data;
using System.Text;
using System.ServiceModel;
using Texfina.Core.Data;
using RHDOQry = Texfina.DOQry.Rh;

namespace Texfina.BOQry.Rh
{

    /// <summary>
    /// Interface para Consultas personalizadas a la Tabla: RH_PerDepen,RH_PerFoto,RH_PerContrato,
    ///  RH_PerPlanilla,RH_Planilla,RH_PerExpeLabo,RH_PerEducacion,RH_Personal,MG_CliProv
    /// </summary>
   [ServiceContract()]
   public interface IPersonal
   {

      /// <summary>
      /// Obtiene las registro de las tablas unidas RH_PerPlanilla y RH_Planilla , por su llave padre.
      /// </summary>
      /// <param name="value">Entidad base</param>
      /// <returns>Retorna un DataTable</returns>
      /// 
      [OperationContract()]
      [NetDataContract()]
      DataTable GetPlanillaXPersonal(IEntityBase value);

      /// <summary>
      /// Obtiene las registro de las tablas unidas RH_Personal y MG_CliProv , por su llave padre.
      /// </summary>
      /// <param name="value">Entidad base</param>
      /// <returns>Retorna un DataTable</returns>
      /// 
      [OperationContract()]
      [NetDataContract()]
      DataTable GetCliProvXPersonal(IEntityBase value);


      /// <summary>
      /// Obtiene los registros de las tablas unidas RH_PerPlanilla.
      /// </summary>
      /// <param name="value">Entidad base</param>
      /// <returns>Retorna un DataTable</returns>
      /// 
      [OperationContract()]
      [NetDataContract()]
      DataTable GetPersonalxPlanilla(IEntityBase value);

    
   }

   
   /// <summary>
   /// Business Object para Consultas a la Tabla: Personal (RH_Personal)
   /// </summary>
   public class Personal : BusinessObjectBase, IBOQuery, IPersonal
   {

      #region IBOQuery Members

      public DataTable GetByCriteria(IEntityBase value)
      {

         IDOQuery objData = (IDOQuery)new RHDOQry.Personal();

         try
         {

            DataTable dt = objData.GetByCriteria(value);

            return dt;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public IEntityBase GetByKey(IEntityBase value)
      {

         IDOQuery objData = (IDOQuery)new RHDOQry.Personal();

         try
         {

            IEntityBase objE = objData.GetByKey(value);

            return objE;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public DataTable GetByParentKey(IEntityBase value)
      {

         IDOQuery objData = (IDOQuery)new RHDOQry.Personal();

         try
         {

            DataTable dt = objData.GetByParentKey(value);

            return dt;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public DataTable GetList(IEntityBase value)
      {

         IDOQuery objData = (IDOQuery)new RHDOQry.Personal();

         try
         {

            DataTable dt = objData.GetList(value);

            return dt;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public bool Exists(IEntityBase value)
      {

         IDOQuery objData = (IDOQuery)new RHDOQry.Personal();

         try
         {

            bool blnRes = objData.Exists(value);

            return blnRes;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      #endregion

      #region IPersonal Members

      public DataTable GetPlanillaXPersonal(IEntityBase value)
      {

         RHDOQry.Personal objData = new RHDOQry.Personal();

         try
         {

            DataTable dt = objData.GetPlanillaXPersonal(value);

            return dt;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public DataTable GetCliProvXPersonal(IEntityBase value)
      {

         RHDOQry.Personal objData = new RHDOQry.Personal();

         try
         {

            DataTable dt = objData.GetCliProvXPersonal(value);

            return dt;

         }
         catch (Exception ex)
         {

            throw ex;

         }

      }

      public DataTable GetPersonalxPlanilla(IEntityBase value)
      {

          RHDOQry.Personal objData = new RHDOQry.Personal();

          try
          {

              DataTable dt = objData.GetPersonalxPlanilla(value);

              return dt;

          }
          catch (Exception ex)
          {

              throw ex;

          }

      }

     #endregion

   }
}
